package com.seal.commons.copiers;

import com.seal.commons.copiers.base.Copier;

import static com.seal.commons.copiers.util.Preconditions.checkNotNull;
/**
 * 功能描述: <br/>
 *
 * @author huangyong
 * @date: 2020-05-31 21:18<br/>
 * @since JDK 1.8
 */

public abstract class AbstractCopier<C, S, T >  implements Copier<S, T> {

    /** 实际执行拷贝的对象 */
    protected final C copier;
    /** 源对象的类型 */
    protected final Class<S> sourceClass;
    /** 目标对象的类型 */
    protected final Class<T> targetClass;

    protected AbstractCopier(Class<S> sourceClass, Class<T> targetClass, C copier) {
        checkNotNull(sourceClass, "source class cannot be null!");
        checkNotNull(targetClass, "target class cannot be null!");
        checkNotNull(copier, "copier cannot be null!");
        this.sourceClass = sourceClass;
        this.targetClass = targetClass;
        this.copier = copier;
    }

    public C getCopier() {
        return copier;
    }

    public Class<S> getSourceClass() {
        return sourceClass;
    }

    public Class<T> getTargetClass() {
        return targetClass;
    }
}